package cn.ekuma.data.ui.android.editor;

import android.os.Bundle;

import com.openbravo.data.user.BrowsableEditableDataModel;
import com.openbravo.data.user.ChildBrowsableDataModel;
import com.openbravo.data.user.I_AndroidBrowsableEditableData;

import cn.ekuma.data.dao.I_ParentNode;

public abstract class AbstractChildListEditorActivate<T,P> extends AbstractListEditorActivate<T>{

	protected I_ParentNode<String> parentNode;
	
	public static final String PARENT_BEAN="parent_bean";
	
	@Override
	protected void initActivate(Bundle savedInstanceState) {
		super.initActivate(savedInstanceState);
		Bundle mBundle=getIntent().getExtras();
		parentNode=(I_ParentNode<String>) mBundle.getSerializable(PARENT_BEAN);
	}

	protected I_AndroidBrowsableEditableData getBrowsableEditableData() {
		AbstractChildDAOJEditor editor=(AbstractChildDAOJEditor)getEditor();
		editor.setParentNode(parentNode);
		return new BrowsableEditableDataModel(new ChildBrowsableDataModel(getDataLogic(),getSuportClass(),parentNode), editor, dirty);
	}

}
